import { CopyInfoPanelBase } from "../CopyInfoPanelBase";
import { Language } from "../../../../../extend/language/Language";
import { MsgManager } from "../../../manager/MsgManager";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { ObjCreate } from "../../common/ObjCreate";
import { ScrollPolicy } from "../../../../../fl/controls/ScrollPolicy";
import { CrossDefenceRewardItemRender } from "./item/CrossDefenceRewardItemRender";
import { SecTimerView } from "../../common/SecTimerView";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
type int = number;
//class CrossDefenceCopyInfoPanel
    
    export  class CrossDefenceCopyInfoPanel extends CopyInfoPanelBase
    {
        constructor()
        {
            super();
            updatePosition();
            this.updateMyMateiralNum(0);
            this.updateMyTowerNum(0);
            this.updateExperience(0);
            return;
        }

        public updateSpringLive(arg1: int): void
        {
            this._txtSpringLive.htmlText = Language.getStringByParam(80291, arg1.toString());
            return;
        }

        public updateMyMateiralNum(arg1: int): void
        {
            this._txtMaterial.htmlText = Language.getStringByParam(80289, arg1.toString());
            return;
        }

        public updateMyTowerNum(arg1: int, arg2: int=25): void
        {
            this._txtToweNum.htmlText = Language.getStringByParam(80290, arg1.toString(), arg2);
            return;
        }

        public updateCountDown(arg1: int): void
        {
            if (arg1 <= 0) 
            {
                return;
            }
            this._countDown.visible = true;
            this._txtBossPatchNum.visible = false;
            this._countDown.setLeftTime(arg1, true);
            this._countDown.timeOutHandler = this.attackTimerOutHandler;
            return;
        }

        /* internal  */attackTimerOutHandler(): void
        {
            this._countDown.stop();
            this._countDown.visible = false;
            this._txtBossPatchNum.visible = true;
            this._txtBossPatchNum.htmlText = Language.getString(80318);
            return;
        }

        public updateBossPatchNum(arg1: int, arg2: Boolean, arg3: Boolean): void
        {
            var loc1=null;
            if (arg3) 
            {
                loc1 = Language.getString(80312);
            }
            else if (arg2) 
            {
                if (arg2) 
                {
                    loc1 = Language.getString(80318);
                }
            }
            else 
            {
                loc1 = Language.getStringByParam(80288, arg1.toString());
            }
            this._txtBossPatchNum.htmlText = loc1;
            if (arg1 != this._lastBossPatchNum) 
            {
                this._lastBossPatchNum = arg1;
                MsgManager.showTaskTarget(loc1);
            }
            return;
        }

        public updateBossPatchByStr(arg1: string): void
        {
            return;
        }

        public updateExperience(arg1: int): void
        {
            this._txtExperienceGot.htmlText = Language.getStringByParam(60427, arg1);
            return;
        }

        public updateReward(arg1: DataProvider): void
        {
            if (!(arg1 == null) && arg1.length > 0) 
            {
                this.switchToReward();
            }
            else 
            {
                this.switchToNoReward();
            }
            this._rewards.dataProvider = arg1;
            return;
        }

        /* internal  */switchToNoReward(): void
        {
            DisplayUtil.removeMe(_bg);
            _bg = new Object /* flash.display.Bitmap */(new Object /* flash.display.BitmapData */(260, 210, false, 0));
            _bg.y = 22;
            _bg.alpha = 0.45;
            _moveSp.addChildAt(_bg, 0);
            this._txtReward.visible = false;
            this._rewards.dataProvider = new DataProvider();
            this._txtDesc.y = 130;
            return;
        }

        /* internal  */switchToReward(): void
        {
            DisplayUtil.removeMe(_bg);
            _bg = new Object /* flash.display.Bitmap */(new Object /* flash.display.BitmapData */(260, 280, false, 0));
            _bg.y = 22;
            _bg.alpha = 0.45;
            _moveSp.addChildAt(_bg, 0);
            this._txtReward.visible = true;
            this._txtDesc.y = 229;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._countDown = ObjCreate.createSecTimeView(Language.getString(80319), 6, 6, 280, 20, _bodySp);
            var loc1=this._countDown.defaultTextFormat;
            loc1.size = 14;
            loc1.bold = true;
            this._countDown.defaultTextFormat = loc1;
            this._countDown.visible = false;
            this._txtBossPatchNum = ObjCreate.createGTextField("", 6, 6, 280, 20, _bodySp);
            loc1 = this._txtBossPatchNum.defaultTextFormat;
            loc1.color = 16776960;
            loc1.size = 14;
            loc1.bold = true;
            this._txtBossPatchNum.defaultTextFormat = loc1;
            this._txtMaterial = ObjCreate.createGTextField("", 6, 30, 200, 20, _bodySp);
            this._txtToweNum = ObjCreate.createGTextField("", 6, 52, 200, 20, _bodySp);
            this._txtSpringLive = ObjCreate.createGTextField("", 6, 74, 200, 20, _bodySp);
            loc1 = this._txtSpringLive.defaultTextFormat;
            loc1.size = 14;
            loc1.color = 16711680;
            loc1.bold = true;
            this._txtSpringLive.defaultTextFormat = loc1;
            this._txtExperienceGot = ObjCreate.createGTextField("", 6, 98, 200, 20, _bodySp);
            loc1 = this._txtExperienceGot.defaultTextFormat;
            loc1.size = 14;
            loc1.color = 16776960;
            loc1.bold = true;
            this._txtExperienceGot.defaultTextFormat = loc1;
            this._txtExperienceGot.htmlText = Language.getStringByParam(60427, 0);
            this._txtReward = ObjCreate.createGTextField(Language.getString(80320), 10, 120, 200, 20, _bodySp);
            this._txtReward.visible = false;
            this._rewards = ObjCreate.createTileList(10, 136, 205, 81, _bodySp);
            this._rewards.scrollPolicy = ScrollPolicy.OFF;
            this._rewards.columnWidth = 41;
            this._rewards.rowHeight = 41;
            this._rewards.setStyle("cellRenderer", CrossDefenceRewardItemRender);
            this._txtDesc = ObjCreate.createGTextField("", 17, 225, 230, 80, _bodySp);
            this._txtDesc.multiline = true;
            this._txtDesc.wordWrap = true;
            loc1 = this._txtDesc.defaultTextFormat;
            loc1.leading = 3;
            this._txtDesc.defaultTextFormat = loc1;
            this._txtDesc.htmlText = Language.getString(80317);
            return;
        }

        /* internal */ /* var */_countDown: SecTimerView;

        /* internal */ /* var */_txtBossPatchNum: GTextFiled;

        /* internal */ /* var */_txtMaterial: GTextFiled;

        /* internal */ /* var */_txtToweNum: GTextFiled;

        /* internal */ /* var */_txtSpringLive: GTextFiled;

        /* internal */ /* var */_txtExperienceGot: GTextFiled;

        /* internal */ /* var */_txtDesc: GTextFiled;

        /* internal */ /* var */_rewards: GTileList;

        /* internal */ /* var */_txtReward: GTextFiled;

        /* internal */ /* var */_lastBossPatchNum: int;
    }
